package cn.iocoder.yudao.module.biz.dal.mysql.htHiddentrouble;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.biz.controller.admin.htHiddentroubleflow.vo.HtHiddentroubleflowExcelVO;
import cn.iocoder.yudao.module.biz.controller.admin.htHiddentroubleflow.vo.HtHiddentroubleflowExportReqVO;
import cn.iocoder.yudao.module.biz.dal.dataobject.htHiddentrouble.HtHiddentroubleDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.biz.controller.admin.htHiddentrouble.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 隐患信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface HtHiddentroubleMapper extends BaseMapperX<HtHiddentroubleDO> {

    default PageResult<HtHiddentroubleDO> selectPage(HtHiddentroublePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<HtHiddentroubleDO>()
                .likeIfPresent(HtHiddentroubleDO::getHtName, reqVO.getHtName())
                .betweenIfPresent(HtHiddentroubleDO::getCheckDate, reqVO.getBeginCheckDate(), reqVO.getEndCheckDate())
                .eqIfPresent(HtHiddentroubleDO::getCategory, reqVO.getCategory())
                .eqIfPresent(HtHiddentroubleDO::getCheckType, reqVO.getCheckType())
                .eqIfPresent(HtHiddentroubleDO::getLevel, reqVO.getLevel())
//                .eqIfPresent(HtHiddentroubleDO::getStates, reqVO.getStates())
                .eqIfPresent(HtHiddentroubleDO::getCheckPeoId, reqVO.getCheckPeoId())
                .eqIfPresent(HtHiddentroubleDO::getBeCheckDeptId, reqVO.getBeCheckDeptId())
                .orderByDesc(HtHiddentroubleDO::getId));
    }

    default List<HtHiddentroubleDO> selectList(HtHiddentroubleExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<HtHiddentroubleDO>()
                .likeIfPresent(HtHiddentroubleDO::getHtName, reqVO.getHtName())
                .betweenIfPresent(HtHiddentroubleDO::getCheckDate, reqVO.getBeginCheckDate(), reqVO.getEndCheckDate())
                .eqIfPresent(HtHiddentroubleDO::getCategory, reqVO.getCategory())
                .eqIfPresent(HtHiddentroubleDO::getCheckType, reqVO.getCheckType())
                .eqIfPresent(HtHiddentroubleDO::getLevel, reqVO.getLevel())
                .eqIfPresent(HtHiddentroubleDO::getState, reqVO.getState())
                .eqIfPresent(HtHiddentroubleDO::getCheckPeoId, reqVO.getCheckPeoId())
                .eqIfPresent(HtHiddentroubleDO::getBeCheckDeptId, reqVO.getBeCheckDeptId())
                .orderByDesc(HtHiddentroubleDO::getId));
    }

    HiddentroubleJoinVO queryById(@Param("id") String id);

    List<HiddentroublePageJoinVO> selectHiddentroublePage(HtHiddentroublePageReqVO pageReqVO);

    Integer selectHiddentroubleCount(HtHiddentroublePageReqVO pageVO);

    Integer isFileExist(@Param("id")String id, @Param("ossId") Long ossId);

}
